<%@page import="net.vinote.smart.platform.service.awe.layout.FullLayout"%>
<%@page import="java.util.Enumeration"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Map"%>
<%@page import="net.vinote.smart.platform.comm.PlatformConst"%>
<%@page import="net.vinote.smart.platform.comm.StringFunction"%>
<%@page import="net.vinote.smart.platform.service.bean.LayoutItem"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@include file="/comm/begin.jsp"%>
<%
	String layoutID = request.getParameter("LayoutID");

		FullLayout layout = new FullLayout(FullLayout.FULL);
		layout.setId(layoutID);
		layout.setOpenEast(false);
		layout.setOpenNorth(false);
		layout.setOpenSouth(false);
		layout.setOpenWest(false);
		List<LayoutItem> layoutItem = SRE.getLayoutItems(layoutID);
		Map<String,String> paramMap=new HashMap<String,String>();
		Enumeration<String> paramEnum=request.getParameterNames();
		while(paramEnum.hasMoreElements()){
			String key=paramEnum.nextElement();
			paramMap.put(key, request.getParameter(key));
		}
		String extendsRequest = StringFunction.getParamterString(paramMap);//将请求参数继承下去
		for (LayoutItem item : layoutItem) {
	String position = item.getPosition();
	String url = item.getPageUrl();
	String size=item.getSize();
	boolean split=!PlatformConst.NO.equals(item.getSplit());
	if (url.indexOf("?") > 0) {
		url = url + "&" + extendsRequest;
	}else{
		url = url + "?" + extendsRequest;
	}
	if(!url.startsWith("http")){
		url=basePath+url;
	}
	String title = StringFunction.nullToBlank(item.getTitle());
	if ("east".equals(position)) {
		layout.setOpenEast(true);
		layout.setEastSrc(url);
		layout.setEastTitle(title);
		layout.setEastWidth(size);
		layout.setEastSplit(split);
	}
	if ("west".equals(position)) {
		layout.setOpenWest(true);
		layout.setWestSrc(url);
		layout.setWestTitle(title);
		layout.setWestWidth(size);
		layout.setWestSplit(split);
	}
	if ("north".equals(position)) {
		layout.setOpenNorth(true);
		layout.setNorthSrc(url);
		layout.setNorthTitle(title);
		layout.setNorthHeight(size);
		layout.setNorthSplit(split);
	}
	if ("south".equals(position)) {
		layout.setOpenSouth(true);
		layout.setSouthSrc(url);
		layout.setSouthSplit(true);
		layout.setSouthTitle(title);
		layout.setSouthHeight(size);
		layout.setSouthSplit(split);
	}
	if ("center".equals(position)) {
		layout.setCenterSrc(url);
		layout.setCenterTitle(title);
	}
		}
		out.print(layout.getHtml());
%>
<%@include file="/comm/end.jsp"%>
